package com.example.studymvvmproject01.login

import androidx.lifecycle.MutableLiveData
import com.example.studymvvmproject01.base.BaseViewModel
import com.example.studymvvmproject01.bean.HomeProadBean
import okhttp3.RequestBody

class LoginViewModel : BaseViewModel() {
    val repository by lazy {
        LoginRepository()
    }

    val loginInfo=MutableLiveData<LoginBean>()
    val homeProadBean=MutableLiveData<HomeProadBean>()
    fun login(requestBody: RequestBody?) {
        launch(
            block = {
                 val token = repository.token(requestBody)
                loginInfo.value=token
            }
        )
    }
    fun workIndex(siteId:Int) {
        launch(
            block = {
                homeProadBean.value= repository.workIndex(siteId)
            }
        )
    }


}